<template>
  <div class="home-container">
    <div class="background-image"></div>
    <div class="nav-buttons">
      <t-button class="nav-btn" theme="primary" @click="goToLogin">Login</t-button>
      <t-button class="nav-btn" theme="primary" variant="outline" @click="goToRegister">Register</t-button>
    </div>
    <div class="content">
      <h1 ref="headline">Welcome to the Website</h1>
      <p class="description">Explore our platform and create something amazing!</p>
    </div>
  </div>
</template>

<script setup>
import { onMounted, ref } from 'vue';
import anime from 'animejs';
import { useRouter } from 'vue-router';

const router = useRouter();

const goToLogin = () => {
  router.push('/login');
};

const goToRegister = () => {
  router.push('/register');
};

const headline = ref(null);

onMounted(() => {
  anime({
    targets: headline.value,
    translateY: [100, 0],
    opacity: [0, 1],
    easing: 'easeOutQuad',
    duration: 1500,
  });

  anime({
    targets: '.description',
    opacity: [0, 1],
    delay: 500,
    easing: 'easeOutQuad',
    duration: 1500,
  });

  anime({
    targets: '.nav-buttons',
    translateY: [-50, 0],
    opacity: [0, 1],
    delay: 1000,
    easing: 'easeOutQuad',
    duration: 1000,
  });
});
</script>

<style scoped>
.home-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  background-color: #000;
}

.background-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url('@/imgs/2.jpg') no-repeat center;
  background-size: cover;
  filter: blur(5px);
}

.nav-buttons {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 10;
  display: flex;
  gap: 10px;
}

.nav-btn {
  font-size: 1rem;
  min-width: 100px;
}

.content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: white;
  z-index: 10;
}

h1 {
  font-size: 4rem;
  font-weight: bold;
  letter-spacing: 2px;
}

.description {
  font-size: 1.2rem;
  margin-top: 20px;
  opacity: 0;
}
</style>